package com.jt.controller;

import com.jt.pojo.User;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.ClientInfoStatus;
import java.util.ArrayList;
import java.util.List;

//@RestController
//@CrossOrigin
//@RequestMapping("/axios")

@RestController
@CrossOrigin
@RequestMapping("/axios")
public class AxiosController {

    @RequestMapping("/getUserById")
    public User getUserById(Integer id) {
        User user = new User();
        user.setName("李四");
        user.setSex("男");
        user.setAge(20);
        user.setId(10);
        return user;
    }

    @RequestMapping("getUserByNA")
    public List<User> getUserByNA(User user) {
        List<User> list = new ArrayList<>();
        user.setId(100);
        user.setSex("男");
        User user1 = new User();
        user1.setId(200);
        user1.setSex("女");
        list.add(user);
        list.add(user);
        return list;
    }

    @RequestMapping("/findUserByNS/{name}/{sex}")
    public List<User> findUSerByNS(User user){
        List<User> list = new ArrayList<>();
        list.add(user);
        list.add(user);
        return list;
    }
}
